include( 'shared.lua' )
include( 'cl_modules/cl_usermessages.lua' )

// Clientside only stuff goes here
function set_team() 
 
 frame = vgui.Create( "DFrame" ) 
 //frame:SetPos( ScrW() / 2, ScrH() / 2 ) //Set the window in the middle of the players screen/game window 
 frame:SetSize( 130, 475 ) //Set the size 
 frame:SetTitle( "Choose your team!" ) //Set title 
 frame:Center()
 frame:SetVisible( true ) 
 frame:SetDraggable( true ) 
 frame:ShowCloseButton( false ) 
 frame:MakePopup() 
 
 team_1 = vgui.Create( "DButton", frame ) 
 team_1:SetPos( 15, 30 )
 team_1:SetSize( 100, 50 ) 
 team_1:SetText( "Citizen" ) 
 team_1.DoClick = function() //Make the player join team 1 
 
     RunConsoleCommand( "team_1" ) 
	 frame:Close()
 
 end 
 
 team_2 = vgui.Create( "DButton", frame ) 
 team_2:SetPos( 15, 85 ) //Place it next to our previous one 
 team_2:SetSize( 100, 50 ) 
 team_2:SetText( "Police" ) 
 team_2.DoClick = function() //Make the player join team 2 
 
     RunConsoleCommand( "team_2" ) 
	 frame:Close()
 
 end
 
 team_3 = vgui.Create( "DButton", frame ) 
 team_3:SetPos( 15, 140 ) //Place it next to our previous one 
 team_3:SetSize( 100, 50 ) 
 team_3:SetText( "Accountant" ) 
 team_3.DoClick = function() //Make the player join team 3 
 
     RunConsoleCommand( "team_3" ) 
	 frame:Close()

 end
 
 team_4 = vgui.Create( "DButton", frame ) 
 team_4:SetPos( 15, 195 ) //Place it next to our previous one 
 team_4:SetSize( 100, 50 ) 
 team_4:SetText( "Scientist" ) 
 team_4.DoClick = function() //Make the player join team 4
 
     RunConsoleCommand( "team_4" ) 
	 frame:Close()
 
 end
 
 team_5 = vgui.Create( "DButton", frame ) 
 team_5:SetPos( 15, 250 ) //Place it next to our previous one 
 team_5:SetSize( 100, 50 ) 
 team_5:SetText( "Assassin" ) 
 team_5.DoClick = function() //Make the player join team 5
 
     RunConsoleCommand( "team_5" ) 
	 frame:Close()
 
 end
 
 team_6 = vgui.Create( "DButton", frame ) 
 team_6:SetPos( 15, 305 ) //Place it next to our previous one 
 team_6:SetSize( 100, 50 ) 
 team_6:SetText( "Pedophile" ) 
 team_6.DoClick = function() //Make the player join team 6
 
     RunConsoleCommand( "team_6" ) 
	 frame:Close()
 
 end
 
 team_7 = vgui.Create( "DButton", frame ) 
 team_7:SetPos( 15, 360 ) //Place it next to our previous one 
 team_7:SetSize( 100, 50 ) 
 team_7:SetText( "Freerunner" ) 
 team_7.DoClick = function() //Make the player join team 7
 
     RunConsoleCommand( "team_7" ) 
	 frame:Close()
 
 end
 
 team_8 = vgui.Create( "DButton", frame ) 
 team_8:SetPos( 15, 415 ) //Place it next to our previous one 
 team_8:SetSize( 100, 50 ) 
 team_8:SetText( "Police Chief" ) 
 team_8.DoClick = function() //Make the player join team 8
 
     RunConsoleCommand( "team_8" ) 
	 frame:Close()
 
 end
 
 end 
 concommand.Add( "team_menu", set_team )
 
 --------------------------------------------------------------------------------
 -------------------------------- THE HUD ---------------------------------------
 --------------------------------------------------------------------------------
 
 hook.Add("HUDPaint", "CreateAbyssHUD", function()
 draw.RoundedBox( 0, ScrW()*0.005, ScrH()*0.847, ScrW()*0.15, ScrH()*0.15, Color( 0, 0, 0, 150 ) )
  draw.RoundedBox( 0, ScrW()*0.006, ScrH()*0.97, math.Clamp(LocalPlayer():Health(), 0, 100)*1.88, ScrH()*0.02, Color( 255, 0, 0, 255 ) )
  draw.RoundedBox( 0, ScrW()*0.006, ScrH()*0.97, math.Clamp(LocalPlayer():Health(), 0, 100)*1.88, ScrH()*0.01, Color( 255, 255, 255, 90 ) ) 
   surface.SetDrawColor( 255, 0, 0, 255 )
   surface.DrawOutlinedRect( ScrW()*0.006, ScrH()*0.97, 188, ScrH()*0.02)
  draw.SimpleText("HP: "..LocalPlayer():Health(), "TargetID", ScrW()*0.065, ScrH()*0.967, Color(0,0,255,255))
 
 // Armor
 local armor1 = "Armor: "..LocalPlayer():Armor()
if LocalPlayer():Armor() < 1 then
	armor1 = "No Armor"
end
  draw.RoundedBox( 0, ScrW()*0.006, ScrH()*0.948, math.Clamp(LocalPlayer():Armor(), 0, 100)*1.88, ScrH()*0.02, Color( 0, 0, 255, 255 ) )
  draw.RoundedBox( 0, ScrW()*0.006, ScrH()*0.948, math.Clamp(LocalPlayer():Armor(), 0, 100)*1.88, ScrH()*0.01, Color( 255, 255, 255, 90 ) )
   surface.SetDrawColor( 0, 0, 255, 255 )
   surface.DrawOutlinedRect( ScrW()*0.006, ScrH()*0.948, 188, ScrH()*0.02)
  draw.SimpleText(armor1, "TargetID", ScrW()*0.05, ScrH()*0.945, Color(255,255,255,255))
  
    draw.SimpleText("Cash: "..LocalPlayer():GetPData("cash"), "TargetID", ScrW()*0.01, ScrH()*0.85, Color(0,255,0,255))
 end)
 
 function hidehud(name)
	for k, v in pairs({"CHudHealth", "CHudBattery"})do
		if name == v then return false end
	end
end
hook.Add("HUDShouldDraw", "Hide the normal HUD", hidehud)